<template>
  <div class="rights">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-table :data="rightsList">
      <el-table-column label="#" width="50"  type="index"></el-table-column>
      <el-table-column label="权限名称" prop="authName"></el-table-column>
      <el-table-column label="路径" prop="path"></el-table-column>
      <el-table-column label="层级" prop="level">
        <template v-slot='{row}'>
          <p v-if="row.level==='0'">一级</p>
          <p v-if="row.level==='1'">二级</p>
          <p v-if="row.level==='2'">三级</p>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data () {
    return {
      rightsList: []
    }
  },
  async created () {
    const { meta, data } = await this.$axios.get('rights/list')
    if (meta.status === 200) {
      this.rightsList = data
      // console.log(data)
    }
  }
}
</script>

<style lang="scss" scoped>
.rights{
  .el-table{
    margin-top: 10px;
  }
}
</style>
